Skip to content

fix: split if-return chains in string-dispatch and type-system#137

Merged
cs01 merged 1 commit intomainfrom
fix/remaining-if-drop-chains
Mar 9, 2026
Merged

fix: split if-return chains in string-dispatch and type-system#137
cs01 merged 1 commit intomainfrom
fix/remaining-if-drop-chains

Conversation

@cs01
Copy link
Owner

@cs01 cs01 commented Mar 9, 2026

Summary

  • Split dispatchStringMethod() (20+ consecutive if-returns) into 4 helper functions with ≤4 branches each
  • Split dispatchArrayMethod() (12+ consecutive if-returns) into 4 helper functions with ≤4 branches each
  • Split canonicalTypeToLlvm() (11+ consecutive if-returns) into 5 helper functions with ≤4 branches each

Mitigates the native compiler's if-drop bug (5th+ consecutive if-return blocks get silently dropped in Stage 0).

Test plan

  • npx tsc --noEmit passes
  • all 434 tests pass
  • npm run verify:quick passes (self-hosting Stage 0 + Stage 1)

@cs01
Copy link
Owner Author

cs01 commented Mar 9, 2026

Shouldn't we fix the root cause of the if drop on 5th if return block? Fix it or at the very least throw a fatal error from the compiler

@cs01 cs01 merged commit dd6910c into main Mar 9, 2026
12 checks passed
@cs01 cs01 deleted the fix/remaining-if-drop-chains branch March 9, 2026 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant